import crudRender from './crud.art';

const html = crudRender({});

class Crud {
    constructor(jq, layer) {
        if (jq === undefined) {
            console.log('args[1] = jQuery');
            return 0;
        }
        this.layer = layer;
        this.jq = jq;
    }

    open(next) {
        this.layer.open({
            type: 1,
            skin: 'layui-layer-rim', //加上边框
            area: ['600px'], //宽高
            btn: ['保存', '取消'],
            yes: function(index){
              next(index);
            },
            content: html
        });
    }
    
    getData() {
        return this.jq('.etable-layer').serialize();
    }
}

export default Crud;